define(() => {
    return function (data) {
        console.log(data);

    // 左侧图片
        /* 第一种方法 原生js */
        // const d = document.querySelector(".smallimg-box img")
        // d.setAttribute("src", data.images_Url);
        
        /* 第二种方法 jQuery */
        $(".smallimg-box").children("img").attr("src", data.proImg);

    // 商品名称
        $(".product-title").children(".title-text").html(data.name);

    // 现价
        $(".price-cur").children("dd").children(".price").children("em").html(data.price);

    // 原价
        $(".price-cur").children("dd").children("._price").find("em").html(parseInt(data.price / (data.discount / 10)));
        
    /* 类型 */
        const details_right = `<dl class="Network-sel">
                                    <dt class="Network-type">${data.select_Network}</dt>
                                    ${createNetwork(data.Network_type)}
                                </dl>
                                <dl class="phone-type">
                                    <dt>${data.select_Color}</dt>
                                    ${createColor(data.Color)}
                                </dl>
                                <dl class="Package-type">
                                    <dt>购买方式</dt>
                                    <dd class="Package">官方标配</dd>
                                </dl>
                                <dl class="storage-type">
                                    <dt>${data.select_text}</dt>
                                    ${createStorage(data.select_Type)}
                                </dl>`;
        
        function createNetwork(network) {
            let str = "";
            network.forEach(val => {
                str += `<dd class="Network">${val.value}</dd>`;
                // console.log(val);
                // console.log(str);
            })
            return str;
        }

        function createColor(color) {
            let str = "";
            color.forEach(val => {
                str += `<dd class="color" title="${val.title}" style="background: url(${val.value}) no-repeat left center / 30px 30px;">${val.text}</dd>`;
            })
            return str;
        }

        function createStorage(storage) {
            let str = "";
            storage.forEach(val => {
                str += `<dd class="storage-capacity">${val.value}</dd>`;
            })
            return str;
        }

        $(".type-list").html(details_right);

        /* 加入购物车 */
        $(".btn-basket").attr("id", data.proId);
        $(".btn-basket").children("i").children("span").html(data.price);

        /* 放大镜 */
        $(".bigimg-box").children("img").attr("src", data.proImg);

        /* 放大镜的多个图列表 */
        const img_list = data.images_list || [];
        let str = "";
        for (let i = 0; i < img_list.length; i++){
            str += `<li><img src="${img_list[i]}"></li>`;
        }
        $(".magnifier-banner-wrap ul").html(str);

    }

})